package com.yc.web.Controller;

import com.yc.config.AiConfig;
import com.yc.config.SearchAiConfig;
import dev.langchain4j.service.TokenStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.FluxSink;

@RestController
public class SearchController {
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(SearchController.class);
    @Autowired
    public SearchAiConfig.SearchAiiAssistant searchAiiAssistant;
    @GetMapping(value = "/api/search")
    public String noMemoryChat(
            @RequestParam("id") String id,
            @RequestParam("name") String name) {
        String question = "请查询学号为" + id + "，学生的姓名为" + name ;
        String result = String.valueOf(searchAiiAssistant.searchStudentdate(question));
        System.out.println(result);
        return searchAiiAssistant.answer(result);

        //return null;
    }



}
